<template>
  <div class="content">

<div class="block">
  <Navigation :navigation-list="[{id:1,value:'首页',url:'/home/index'},{id:2,value:'个人中心',url:'/mine-center/enterprise'}]"></Navigation>
    <div class="search-content-in">
      <div class="content-menu">
        <div class="btn2 menu-title">个人中心</div>
        <div class="menu-list">
          <div v-for="(item,index) in menuList" class="menu-item">
            <div v-if="item.id!=7" :class="tableId===item.id?'menu-list-content-check':''" class="menu-list-content" @click="sonTo(item.id)">{{item.title}}
              <template v-if="item.id===3">
               <div class="num" v-if="number>0"> {{number}}</div>
              </template>
              <template v-if="item.id===9">
                <div v-if="user.authenticationStatus != 9" style="color:red; font-size: 14px; " > {{user.rregisterStateText}}</div>
                <div v-if="user.authenticationStatus == 9" style="color:chartreuse;font-size: 14px"> {{user.rregisterStateText}}</div>
                <div> </div>
              </template>
              <i v-if="tableId===item.id" class="el-icon-caret-right" style="display: flex; justify-content: flex-end; color: #FE7725;"></i>
            </div>
            <div class="menu-list-content" v-else>
              <router-link :to="{name:'Chat'}">{{item.title}} </router-link>
            </div>
          </div>
        </div>
      </div>
      <div class="list-content">
        <div>
          <div class="news-list">
            <Account v-if="tableId===1"></Account>
            <PositionManagement v-if="tableId===2"></PositionManagement>
            <GetResume v-if="tableId===3"></GetResume>
            <CompanyInfo v-if="tableId===6"></CompanyInfo>
            <GetLookMeConcern v-if="tableId===4"></GetLookMeConcern>
            <GetLookMe v-if="tableId===5"></GetLookMe>
            <JobFairManagement v-if="tableId===8"></JobFairManagement>
            <MyProfile v-if="tableId===9"></MyProfile>
          </div>
        </div>
      </div>
    </div>
</div>
  </div>
</template>

<script>
import CompanyInfo from "@/components/MineCenter/Enterprise/CompanyInfo";
import Account from "@/components/MineCenter/Enterprise/Account";
import Navigation from "@/components/Navigation/Navigation";
import PositionManagement from "@/components/MineCenter/Enterprise/PositionManagement";
import GetResume from "@/components/MineCenter/Enterprise/GetResume";
import GetLookMeConcern from "@/components/MineCenter/Enterprise/GetLookMeConcern";
import GetLookMe from "@/components/MineCenter/Enterprise/GetLookMe";
import {getResumeNumberApi} from "@/api/position";
import JobFairManagement from "@/components/MineCenter/Enterprise/JobFairManagement";
import MyProfile from "@/components/MineCenter/Enterprise/MyProfile";
import {mapGetters} from "vuex";
export default {
  components: {
    MyProfile,
    Account,Navigation,CompanyInfo,PositionManagement,GetResume,GetLookMeConcern,GetLookMe,JobFairManagement
  },
  data() {
    return {
      tableId: 1,
      menuList: [
        {id: 1, count: 0, title: "个人中心"},
        {id: 6, count: 0, title: "我的企业信息"},
        {id: 9, count: 0, title: "我的资料"},
        {id: 2, count: 0, title: "职位管理"},
        {id: 3, count: 0, title: "我收到的简历"},
        {id: 4, count: 0, title: "我关注的人才"},
        {id: 5, count: 0, title: "谁看过我"},
        {id: 8, count: 0, title: "我的招聘会"},

      ],
      newsList: [

      ],
      number: 0,
    }
  },
  methods:{
    getResumeNumber() {
      getResumeNumberApi().then((res) => {
          this.number = res ?? 0
      }).catch((res) => {
        console.log(res)
      })
    },
    sonTo(timeId)
    {
      if(timeId==6||timeId==2)
      {
        this.$store.dispatch('user/getUser').then((res)=>{
          if(res.authenticationStatus!=9)
          {
            this.$message.info('信息审核未通过');
            return;
          }else{
            this.tableId = timeId;
          }
        })
      }else{
        this.tableId = timeId;
      }

    }

  },

  mounted() {
   if(this.$route.query.tableId==='2'||this.$route.query.tableId==='6')
   {
      this.tableId = parseInt(this.$route.query.tableId);
   }
    if(this.tableId===1)
    {
      this.getResumeNumber();
    }
  },
  computed: {
    ...mapGetters(['user'])
  }
}
</script>

<style lang="scss" scoped>
.block {
  width: $contentWidth;
  margin: 0 auto;
  margin-top: 16px;
  min-height: $fullMinHeight;
}
.content{
  background-color: #F6F6F6;
  .content-title{
    margin: 20px 0 0 40%;
    width: 400px;
    height: 30px;
    cursor: auto;

  }
  .search-content-in {
    padding-top: 20px;
    display: flex;
    .content-menu {
      width: 260px;
      background-color: #FFFFFF;
      border-radius: 5px;
      height: 100%;
      .menu-title{
        width: 240px;
        height: 70px;
        cursor: auto;
        border-radius: 5px;
        font-size: 30px;
        margin: 10px 10px 0 10px;
        font-family: fzhzgbjt;
      }
      .menu-list{
        margin: 30px 10px 0 10px;
        .menu-list-content{
          display: flex;
          flex-direction: row;
          align-items: center;
          justify-content: space-between;
          font-size: 20px;
          padding: 11px 10px 12px 20px;
          border-bottom: 1px solid #F6F6F6;
          cursor: pointer;
          .num{
            width: 15px;
            height: 15px;
            border-radius: 50%;
            font-size: 12px;
            background: #FF3300;
            color: #fff;
            position: absolute;
            margin-left: 120px;
            margin-top: -20px;
            text-align: center;
          }
        }
        .menu-list-content-check{
          color: #FE7725;
        }

      }
    }
    .list-content{
      margin-left: 10px;
      .list-content-title{
        height: 55px;
        color: #FE7725;
        font-size: 24px;
        border-bottom: 1px solid #DBDBDB;
        margin: 30px 0 0 30px;
      }
      .news-list{
        padding-bottom: 15px;
        width: 900px;
        display: flex;
        //cursor: pointer;
        .news-list-title{
          width: calc(90% - 3px);
        }
        .news-list-time{
          color: #DBDBDB;
        }
      }
    }
  }
  .position-search-content {
    width: 100%;
    margin-top: 0;
    height: 150px;
    background: #fff;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    .input-block {
      width: 900px;
      height: 55px;
      box-shadow: 3px 5px 15px 0 rgb(0 0 0 / 10%);
      border-radius: 30px;
      padding: 6px 0;
      display: flex;
      flex-direction: row;
      align-items: center;

      input {
        width: calc(100% - 110px);
        height: 100%;
        display: flex;
        align-items: center;
        background: none;
        padding: 0 20px;
        font-size: 18px;
      }

      .search-btn {
        width: 100px;
        height: 100%;
      }
    }

    .hot-block {
      width: 900px;
      display: flex;
      margin-top: 20px;
      flex-direction: row;
      color: $darkGray;
      font-size: 17px;
      padding-left: 10px;

      .hot-item {
        color: $darkGray;
        margin: 0 15px;
        cursor: pointer;
      }
    }
  }

}


</style>
